package com.globallogic.vkulyk.SSHTool;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class SSHToolTester {
	public String targetsFile = "";
	public String target = "";
	public String host = "";
	public int port = 0;
	public String host2 = "";
	public int port2 = 0;
	public String user = "";
	public String password = "";
	public String user2 = "";
	public String password2 = "";
	public String command = "";
	public String srcFileForPut = "";
	public String dstDirForPut = "";
	public String srcFileForGet = "";
	public String dstDirForGet = "";
	public String script = "";

	private Properties properties = null;
	private String propertiesFile = null;

	public void setVarsFromPropertiesFile(String propertiesFile) {
		this.propertiesFile = propertiesFile;
		loadProperties();
		setVarsFromProperties();
	}

	public void loadProperties() {
		properties = new Properties();
		try {
			properties.load(new FileInputStream(propertiesFile));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public void setVarsFromProperties() {
		targetsFile = properties.getProperty("targetsFile");
		target = properties.getProperty("target");
		host = properties.getProperty("host");
		port = Integer.parseInt(properties.getProperty("port"));
		host2 = properties.getProperty("host2");
		port2 = Integer.parseInt(properties.getProperty("port2"));
		host = properties.getProperty("host");
		user = properties.getProperty("user");
		password = properties.getProperty("password");
		user2 = properties.getProperty("user2");
		password2 = properties.getProperty("password2");
		command = properties.getProperty("command");
		srcFileForPut = properties.getProperty("srcFileForPut");
		dstDirForPut = properties.getProperty("dstDirForPut");
		srcFileForGet = properties.getProperty("srcFileForGet");
		dstDirForGet = properties.getProperty("dstDirForGet");
		script = properties.getProperty("script");
	}

}
